package com.vs.meepet

import android.content.Intent
import android.os.Bundle
import com.vs.meepet.platform.GeeTestPlugin
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine

class MainActivity : FlutterActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        initView(intent)
    }

    override fun onNewIntent(intent: Intent) {
        super.onNewIntent(intent)
        initView(intent)
    }

    private fun initView(intent: Intent) {

    }

    override fun onStart() {
        super.onStart()
    }

    override fun onResume() {
        super.onResume()
        flutterEngine?.lifecycleChannel?.appIsResumed()
    }

    override fun onPause() {
        super.onPause()
        flutterEngine?.lifecycleChannel?.appIsPaused()
    }

    override fun onDetachedFromWindow() {
        super.onDetachedFromWindow()
        flutterEngine?.lifecycleChannel?.appIsDetached()
    }

    override fun onWindowFocusChanged(hasFocus: Boolean) {
        super.onWindowFocusChanged(hasFocus)
        if (hasFocus) {
            flutterEngine?.lifecycleChannel?.aWindowIsFocused()
        } else {
            flutterEngine?.lifecycleChannel?.noWindowsAreFocused()
        }
    }

    override fun onDestroy() {
        super.onDestroy()

    }

    override fun onBackPressed() {
        super.onBackPressed()
    }

    override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
        super.configureFlutterEngine(flutterEngine)
        flutterEngine.plugins.add(GeeTestPlugin())
    }
}
